package com.kkb.service;

import com.kkb.mapper.UserMapper;
import com.kkb.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author:CoolTiger
 * @title: UserService
 * @projectName ssm_hospital
 * @description: TODO
 * @date:2022/07/08/15:12:28
 **/
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    /**
     * TODO 登陆业务
     * @param user
     * @return
     */
    @Transactional(propagation = Propagation.REQUIRED,readOnly = true)
    public User login(User user){
        try {
//            user.setuPassword(UserUtil.MD5(user.getuPassword()));
            User exsitUser = userMapper.queryUser(user);
            return exsitUser;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

    }

}
